(function() {
  var __hasProp = {}.hasOwnProperty,
    __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };

  this.AdminUserCreateView = (function(_super) {

    __extends(AdminUserCreateView, _super);

    function AdminUserCreateView() {
      return AdminUserCreateView.__super__.constructor.apply(this, arguments);
    }

    AdminUserCreateView.prototype.el = $('#content');

    AdminUserCreateView.prototype.initialize = function() {
      return AdminUserCreateView.__super__.initialize.apply(this, arguments);
    };

    AdminUserCreateView.prototype.render = function() {
      var el, model;
      model = this.model;
      el = $(this.el);
      return this.GetTemplate(SiteMap.Admin.Users.CreateTemplate, function(compiledTemplate) {
        el.html(compiledTemplate(model.toJSON()));
        $("#Status").combobox();
        return $("#Avatar").ImageUpload();
      });
    };

    AdminUserCreateView.prototype.events = {
      "click .buttons>button.save": "save",
      "click .buttons>button.cancel": "cancel"
    };

    AdminUserCreateView.prototype.save = function(e) {
      var data,
        _this = this;
      e.preventDefault();
      Loading.Start();
      Messages.WriteMessage('Creating user.');
      data = $(this.el).find("form.general").serialize();
      return $.post(SiteMap.Admin.Users.Create, data, function(response) {
        if ((response.SuccessMessage != null) && response.SuccessMessage.length) {
          Messages.WriteSuccessMessage(response.SuccessMessage);
          return _this.Navigate(SiteMap.Admin.Users.Listing, true);
        } else {
          Messages.WriteErrors(response.Errors);
          return Loading.Stop();
        }
      });
    };

    AdminUserCreateView.prototype.cancel = function(e) {
      e.preventDefault();
      Loading.Start();
      Messages.Clear();
      return this.Navigate(SiteMap.Admin.Users.Listing, true);
    };

    return AdminUserCreateView;

  })(CustomView);

}).call(this);
